local sk__fuhan = fk.CreateSkill {

  name = "sk__fuhan",

  tags = {  },

}



sk__fuhan:addEffect(fk.CardUseFinished, {
  name = "sk__fuhan",
  anim_type = "special",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(sk__fuhan.name) and data.card and data.card:isVirtual() and
      data.card.subcards and #data.card.subcards > 0 and
      player:usedSkillTimes(sk__fuhan.name, Player.HistoryTurn) == 0
  end,
  on_cost = function (self,event, target, player, data)
    return player.room:askForSkillInvoke(player, sk__fuhan.name, nil, "#sk__fuhan-invoke")
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local skills = {}
    for _, general in ipairs(room.general_pile) do
      local g = Fk.generals[general]
      if g.kingdom == "shu" then
        table.insertTableIfNeed(skills, g:getSkillNameList())
      end
    end
    skills = table.filter(skills, function(s)
      return not player:hasSkill(s, true)
    end)
    if #skills == 0 then return end
    room:handleAddLoseSkills(player, table.random(skills), nil, true, false)
  end,
})

return sk__fuhan